import 'dart:convert';

import 'package:yqmssa_app/generated/json/base/json_field.dart';
import 'package:yqmssa_app/generated/json/login_entity.g.dart';

export 'package:yqmssa_app/generated/json/login_entity.g.dart';

@JsonSerializable()
class LoginEntity {
  String token = '';
  @JSONField(name: 'is_having_info')
  bool isHavingInfo = false;
  String avatar = '';
  @JSONField(name: 'jump_xcx')
  int jumpXcx = 0;
  @JSONField(name: 'open_chat')
  int openChat = 0;
  @JSONField(name: 'is_link')
  int isLink = 0;
  @JSONField(name: 'jump_scan')
  int jumpScan = 0;
  @JSONField(name: 'is_open_ab')
  int isOpenAb = 0;
  @JSONField(name: 'is_xcx')
  int isXcx = 0;
  @JSONField(name: 'is_chat')
  int isChat = 0;
  @JSONField(name: 'chat_bot')
  int chatBot = 0;
  @JSONField(name: 'have_pop')
  int havePop = 0;
  @JSONField(name: 'have_call')
  int haveCall = 0;
  @JSONField(name: 'chat_we_text')
  String chatWeText = '';
  @JSONField(name: 'add_wx_button')
  late LoginAddWxButton addWxButton;

  LoginEntity();

  factory LoginEntity.fromJson(Map<String, dynamic> json) => $LoginEntityFromJson(json);

  Map<String, dynamic> toJson() => $LoginEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class LoginAddWxButton {
  @JSONField(name: 'add_wx_view')
  int addWxView = 0;
  @JSONField(name: 'chat_we_text')
  String chatWeText = '';

  LoginAddWxButton();

  factory LoginAddWxButton.fromJson(Map<String, dynamic> json) => $LoginAddWxButtonFromJson(json);

  Map<String, dynamic> toJson() => $LoginAddWxButtonToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
